<!DOCTYPE html>
<html class="no-js" lang="">
<head>#include( "/public-head.html")</head>

<body style="background-color: #ffffff !important;">
	<div class="main-content checkbo">
		<div class="panel mb25">
			<div class="panel-heading border">编辑票务</div>
			<div class="panel-body">
				<div class="row no-margin">
						<form action="/vrs/ticket/edit.jsn" data-url="/vrs/ticket/list.jsn" id="ticketForm" name="ajaxForm"
							class="form-horizontal bordered-group" role="form">
							<input type="hidden" name="ticket.ticketId" value="$!{ticket.ticketId}">
							<div class="form-group">
								<label class="col-sm-2 control-label">名称</label>
								<div class="col-sm-10">
									<input type="text" name="ticket.name" value="$!{ticket.name}" class="form-control w150" placeholder="名称">
								</div>
							</div>
                            <div class="form-group">
	                            <label class="col-sm-2 control-label">类型</label>
	                            <div id="isendRadio" class="col-sm-10">
	                                <label class="cb-radio">
	                                    <input type="radio"  onchange="checkTicketType();" required name="ticket.type" value="1" />通票
	                                </label>
	                                <label class="cb-radio">
	                                    <input type="radio"  onchange="checkTicketType();" required name="ticket.type" value="0" />单日票
	                                </label>
	                            </div>
                            </div>
                            <div class="form-group">
								<label class="col-sm-2 control-label">频道</label>
								<div >
									<select id="channelSelect"  data-placeholder="请选择频道" class="chosen w200" >
										 <option value=""></option>
									</select>
									<span style="color: #CDC5BF">*仅用于过滤专辑</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">专辑</label>
								<div >
									<select id="albumSelect"  required data-placeholder="请选择频道" class="chosen w200" name="ticket.albumId">
										#foreach( $row in $!{albumlist})
	                                    	#if($row.albumId == $ticket.albumId)
	                                    		<option value="$!{row.albumId}" selected="selected">$!{row.name}</option>
	                                    	#else
	                                    		<option value="$!{row.albumId}">$!{row.name}</option>
	                                    	#end
	                                    #end
									</select>
								</div>
							</div>
							<div id="videodiv" class="form-group">
								<label class="col-sm-2 control-label">视频</label>
								<div >
									<select id="videoIdSelect" data-placeholder="请选择视频" class="chosen w200" name="ticket.videoIds">
	                            		#if($ownvideos)
		                                    #foreach( $row in $!{videolist})
			                                    	#foreach( $row1 in $!{ownvideos})
				                                    	#if($row.videoId == $row1)
				                                    		<option value="$!{row.videoId}" selected="selected">$!{row.name}</option>
				                                    	#else
				                                    		<option value="$!{row.videoId}">$!{row.name}</option>
				                                    	#end
				                                    #end
				                                    	
		                                    #end
	                                   	#else
	                                   		#foreach( $row2 in $!{videolist})
				                                <option value="$!{row2.videoId}">$!{row2.name}</option>
		                                    #end
	                                   	#end
	                            	</select>
                            	</div>
							</div>
                        
							<div class="form-group">
								<label class="col-sm-2 control-label">票价</label>
								<div class="col-sm-10">
									<input type="text" number  name="ticket.price" value="$!{ticket.price}" class="form-control w150" placeholder="票价">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">日期</label>
								<div class="col-sm-10">
                                    <input type="text" id="ticketdate" required  class="form-control w150 vrs-date" value="$!{ticket.date}" data-provide="datepicker">
									<!--data-date-format="yyyy-mm-dd"-->
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">节目单描述</label>
								<div class="col-sm-10">
									<input type="text" name="ticket.scheduleName" value="$!{ticket.scheduleName}" class="form-control w150" placeholder="节目单名">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">节目单URL</label>
								<div class="col-sm-10">
									<input type="text" name="ticket.schedule" value="$!{ticket.schedule}" class="form-control w150" placeholder="节目单URL">
								</div>
							</div>
							<div class="form-group">
								<label></label>
								<div>
									<button type="button" onclick="submitPerForm()" class="btn btn-primary mr10">修改</button>
									<button class="btn btn-default">返回</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>


	</div>
	<!-- /main area -->
	#include( "/public-script.html")
	<script type="text/javascript" src="/scripts/custom/custom.ticket.js"></script>
	#include( "/sub-script.html") 
	<script>
		//radio
	    initEditRadio('isendRadio','$!{ticket.type}')
	    checkTicketType();
		
		//选择票务类型
		function checkTicketType(){
			var $selectedvalue = $("input[name='ticket.type']:checked").val();
			if ($selectedvalue == 1) {
				$("#videodiv").hide();
			}else {
				$("#videodiv").show();
			}
		}
		
		//提交
		function submitPerForm() {
			//判断是否校验
			var $selectedvalue = $("input[name='ticket.type']:checked").val();
			if ($selectedvalue == 1) {
				$('#videoIdSelect').rules("remove", "required");
			} else {
				$('#videoIdSelect').rules("add", {
					required : true
				});
			}
			if (!$('#ticketForm').valid()) {
				return false;
			} else {
				$('#ticketForm').submit();
			}
		}
	</script>
</body>

</html>
